import request from '@/utils/request'

const api = {
  orderToDispatchUrl: '/mes_dispatch/order_to_dispatch',
  orderDownCancelUrl: '/mes_dispatch/order_down_cancel',
  getKpDispatchPageUrl: '/mes_dispatch/get_kp_dispatch_page',
  getCavityDispatchDefaultUrl: '/mes_dispatch/get_cavity_dispatch_default',
  equipDispatchUrl: '/mes_dispatch/equip_dispatch',
  getEquipDateDispatchUrl: '/mes_dispatch/get_equip_date_dispatch',
  equipDispatchAloneUrl: '/mes_dispatch/equip_dispatch_alone',
  getDispatchByCavityUrl: '/mes_dispatch/get_dispatch_by_cavity',
  getDispListPageUrl: '/mes_dispatch/get_disp_list_page',
  getEquipDataAloneDispatchUrl: '/mes_dispatch/get_equip_data_alone_dispatch',
  getDispByHpkUrl: '/mes_dispatch/get_disp_hpk',
  fanDispatchJungongUrl: '/mes_dispatch/fan_dispatch_jungong',
  removeDispatchUrl: '/mes_dispatch/remove_dispatch',
  removeDispatchMoldUrl: 'mes_dispatch/remove_dispatch_mold',
  orderListToDispatchUrl: '/mes_dispatch/order_list_to_dispatch',
  orderListDownCancelUrl: '/mes_dispatch/order_list_down_cancel',
  getUserEquipUrl: '/mes_dispatch/get_user_equip',
  getCurrentDispatchUrl: '/mes_dispatch/get_current_dispatch',

  getDispatchMoldEquUrl: '/mes_dispatch/get_dispatch_mold_equ',
  setDispatchCurrentUrl: '/mes_dispatch/set_dispatch_current',
  getCurrentDispatchNomoldUrl: '/mes_dispatch/get_current_dispatch_nomold',
  getDispatchEquUrl: '/mes_dispatch/get_dispatch_equ',
  dispatchJungongMoldUrl: '/mes_dispatch/dispatch_jungong_mold',
}

export async function dispatchJungongMoldApi(params: Map<string, any>) {
  const res = await request({
    url: api.dispatchJungongMoldUrl,
    method: 'get',
    params,
  })
  return res
}

export async function getDispatchEquApi(params: Map<string, any>) {
  const res = await request({
    url: api.getDispatchEquUrl,
    method: 'get',
    params,
  })
  return res
}

export async function getCurrentDispatchNomoldApi(params: Map<string, any>) {
  const res = await request({
    url: api.getCurrentDispatchNomoldUrl,
    method: 'get',
    params,
  })
  return res
}

export async function setDispatchCurrentApi(params: Map<string, any>) {
  const res = await request({
    url: api.setDispatchCurrentUrl,
    method: 'get',
    params,
  })
  return res
}

export async function getDispatchMoldEquApi(params: Map<string, any>) {
  const res = await request({
    url: api.getDispatchMoldEquUrl,
    method: 'get',
    params,
  })
  return res
}

export async function getCurrentDispatchApi(params: Map<string, any>) {
  const res = await request({
    url: api.getCurrentDispatchUrl,
    method: 'get',
    params,
  })
  return res
}

export async function getUserEquipApi(params: Map<string, any>) {
  const res = await request({
    url: api.getUserEquipUrl,
    method: 'get',
    params,
  })
  return res
}

export async function orderListDownCancelApi(data: Map<string, any>) {
  const res = await request({
    url: api.orderListDownCancelUrl,
    method: 'post',
    data,
    timeout: 300000,
  })
  return res
}

export async function orderListToDispatchApi(data: Map<string, any>) {
  const res = await request({
    url: api.orderListToDispatchUrl,
    method: 'post',
    data,
    timeout: 300000,
  })
  return res
}

export async function removeDispatchMoldApi(params: Map<string, any>) {
  const res = await request({
    url: api.removeDispatchMoldUrl,
    method: 'get',
    params: params,
  })
  return res
}

export async function removeDispatchApi(params: Map<string, any>) {
  const res = await request({
    url: api.removeDispatchUrl,
    method: 'get',
    params: params,
  })
  return res
}

export async function fanDispatchJungongApi(params: Map<string, any>) {
  const res = await request({
    url: api.fanDispatchJungongUrl,
    method: 'get',
    params: params,
  })
  return res
}

export async function getDispByHpkApi(params: Map<string, any>) {
  const res = await request({
    url: api.getDispByHpkUrl,
    method: 'get',
    params: params,
  })
  return res
}

export async function getDispListPageApi(data: Map<string, any>) {
  const res = await request({
    url: api.getDispListPageUrl,
    method: 'post',
    data,
  })
  return res
}

export async function getEquipDataAloneDispatchApi(params: Map<string, any>) {
  const res = await request({
    url: api.getEquipDataAloneDispatchUrl,
    method: 'get',
    params: params,
  })
  return res
}

export async function getDispatchByCavityApi(params: Map<string, any>) {
  const res = await request({
    url: api.getDispatchByCavityUrl,
    method: 'get',
    params: params,
  })
  return res
}

export async function equipDispatchAloneApi(params: Map<string, any>) {
  const res = await request({
    url: api.equipDispatchAloneUrl,
    method: 'post',
    data: params,
  })
  return res
}

export async function getEquipDateDispatchApi(params: Map<string, any>) {
  const res = await request({
    url: api.getEquipDateDispatchUrl,
    method: 'get',
    params: params,
  })
  return res
}

export async function equipDispatchApi(params: Map<string, any>) {
  const res = await request({
    url: api.equipDispatchUrl,
    method: 'post',
    data: params,
  })
  return res
}

export async function orderToDispatchApi(params: Map<string, any>) {
  const res = await request({
    url: api.orderToDispatchUrl,
    method: 'post',
    data: params,
  })
  return res
}
export async function orderDownCancelApi(params: Map<string, any>) {
  const res = await request({
    url: api.orderDownCancelUrl,
    method: 'post',
    data: params,
  })
  return res
}
export async function getKpDispatchPageApi(params: Map<string, any>) {
  const res = await request({
    url: api.getKpDispatchPageUrl,
    method: 'post',
    data: params,
  })
  return res
}

export async function getCavityDispatchDefaultApi(params: Map<string, any>) {
  const res = await request({
    url: api.getCavityDispatchDefaultUrl,
    method: 'post',
    data: params,
  })
  return res
}
